package com.superjson.showpro.entity;

import com.superjson.showpro.base.BaseObj;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;

/**
 * Created By zby on 20:37 2019/5/28
 * 区域类
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Entity
@Table(name = "sp_area")
public class Area extends BaseObj implements Serializable{

    private static final long serialVersionUID = 2293015062298587953L;
    /**
     * 父新政区划；顶层为null
     */
    @ManyToOne
    @JoinColumn(name = "parent_id")
    private Area parent;

    /**
     * 全路径，比如110000-110100-110101
     */
    @Column(name = "full_id_path", length = 100)
    private String fullIdPath;

    /**
     * 全value路径，比如北京市-市辖区-东城区
     */
    @Column(name = "full_value_path", length = 200)
    private String fullValuePath;

    /**
     * 纬度
     */
    @Column(name = "latitude")
    private Double latitude;

    /**
     * 层级关系
     */
    @Column(columnDefinition = " int(3) not null default 1")
    private Integer level;

    /**
     * 经度
     */
    @Column(name = "longitude")
    private Double longitude;

    /**
     * 排序规则
     */
    @Column(name = "sort")
    private Integer sort;

    /**
     * 类型
     * province:省
     * city:市
     * district: 区
     * logic:逻辑节点，不如市辖区 县 旗等。
     * street
     */
    @Column(length = 58, nullable = false)
    private String type;

    /**
     * 地区名
     */
    @Column(length = 200)
    private String value;

}